/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.model.qnrlibrary;


import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;


/**
 *
 * @author rejun001
 */
@Entity
@Table( name = "categories" )
@XmlRootElement
@NamedQueries( 
{
    @NamedQuery( name = "Categories.findAll" , query = "SELECT c FROM Categories c" ) ,
    @NamedQuery( name = "Categories.findByCategoryId" , query = "SELECT c FROM Categories c WHERE c.categoryId = :categoryId" ) ,
    @NamedQuery( name = "Categories.findByCategory" , query = "SELECT c FROM Categories c WHERE c.category = :category" ) ,
    @NamedQuery( name = "Categories.findByDisplaySeq" , query = "SELECT c FROM Categories c WHERE c.displaySeq = :displaySeq" ) ,
    @NamedQuery( name = "Categories.findByCreatedBy" , query = "SELECT c FROM Categories c WHERE c.createdBy = :createdBy" ) ,
    @NamedQuery( name = "Categories.findByDateCreated" , query = "SELECT c FROM Categories c WHERE c.dateCreated = :dateCreated" ) ,
    @NamedQuery( name = "Categories.findByModifiedBy" , query = "SELECT c FROM Categories c WHERE c.modifiedBy = :modifiedBy" ) ,
    @NamedQuery( name = "Categories.findByDateModified" , query = "SELECT c FROM Categories c WHERE c.dateModified = :dateModified" )
} )
public class Categories implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic( optional = false )
    @Column( name = "category_id" )
    private String categoryId;
    @Basic( optional = false )
    @Column( name = "category" )
    private String category;
    @Column( name = "display_seq" )
    private BigInteger displaySeq;
    @Basic( optional = false )
    @Column( name = "created_by" )
    private String createdBy;
    @Basic( optional = false )
    @Column( name = "date_created" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateCreated;
    @Column( name = "modified_by" )
    private String modifiedBy;
    @Column( name = "date_modified" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateModified;
    @OneToMany( cascade = CascadeType.ALL , mappedBy = "categoryId" )
    private Collection<CategoryContent> categoryContentCollection;


    public Categories()
    {
    }


    public Categories( String categoryId )
    {
        this.categoryId = categoryId;
    }


    public Categories( String categoryId , String category , String createdBy , Date dateCreated )
    {
        this.categoryId = categoryId;
        this.category = category;
        this.createdBy = createdBy;
        this.dateCreated = dateCreated;
    }


    public String getCategoryId()
    {
        return categoryId;
    }


    public void setCategoryId( String categoryId )
    {
        this.categoryId = categoryId;
    }


    public String getCategory()
    {
        return category;
    }


    public void setCategory( String category )
    {
        this.category = category;
    }


    public BigInteger getDisplaySeq()
    {
        return displaySeq;
    }


    public void setDisplaySeq( BigInteger displaySeq )
    {
        this.displaySeq = displaySeq;
    }


    public String getCreatedBy()
    {
        return createdBy;
    }


    public void setCreatedBy( String createdBy )
    {
        this.createdBy = createdBy;
    }


    public Date getDateCreated()
    {
        return dateCreated;
    }


    public void setDateCreated( Date dateCreated )
    {
        this.dateCreated = dateCreated;
    }


    public String getModifiedBy()
    {
        return modifiedBy;
    }


    public void setModifiedBy( String modifiedBy )
    {
        this.modifiedBy = modifiedBy;
    }


    public Date getDateModified()
    {
        return dateModified;
    }


    public void setDateModified( Date dateModified )
    {
        this.dateModified = dateModified;
    }


    @XmlTransient
    public Collection<CategoryContent> getCategoryContentCollection()
    {
        return categoryContentCollection;
    }


    public void setCategoryContentCollection( Collection<CategoryContent> categoryContentCollection )
    {
        this.categoryContentCollection = categoryContentCollection;
    }


    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += ( categoryId != null ? categoryId.hashCode() : 0 );
        return hash;
    }


    @Override
    public boolean equals( Object object )
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if ( !( object instanceof Categories ) )
        {
            return false;
        }
        Categories other = (Categories) object;
        if ( ( this.categoryId == null && other.categoryId != null ) || ( this.categoryId != null && !this.categoryId.equals( other.categoryId ) ) )
        {
            return false;
        }
        return true;
    }


    @Override
    public String toString()
    {
        return "idea.model.qnrlibrary.Categories[ categoryId=" + categoryId + " ]";
    }
    
}
